package com.motu.vertx.module.utility.logsdk;

import io.vertx.core.json.JsonObject;

public class NewbiRequestInfo {
	public static final String TYPE_REGISTER = "register";//注册日志
	public static final String TYPE_LOGIN = "loggedin";//登录日志
	public static final String TYPE_PAYMENT = "payment";//充值日志
	public static final String TYPE_EVENT = "event";//自定义事件日志
	public static final String TYPE_INSTALL = "install";//安装日志
	public static final String TYPE_STARTUP = "startup";//启动日志
	public static final String TYPE_MONITOR = "monitor";//监控日志
	
	public static final int MONITOR_TYPE_ROLE_NAME = 1;//角色取名
	public static final int MONITOR_TYPE_FAMILY_NAME = 2;//帮派取名
	public static final int MONITOR_TYPE_ROLE_SIGNATURE = 3;//角色签名
	public static final int MONITOR_TYPE_ROLE_DECLARATION = 4;//角色宣言
	public static final int MONITOR_TYPE_FAMILY_NOTICE = 5;//帮派公告
	public static final int MONITOR_TYPE_FAMILY_DECLARATION = 6;//帮派宣言
	public static final int MONITOR_TYPE_PUBLIC_CHAT = 7;//世界聊天
	public static final int MONITOR_TYPE_FAMILY_CHAT = 8;//帮派聊天
	public static final int MONITOR_TYPE_PRIVATE_CHAT = 9;//私人聊天
	public static final int MONITOR_TYPE_BUDDY_MAIL = 10;//好友邮件
	public static final int MONITOR_TYPE_OTHERS = 11;//其他
	public static final int MONITOR_TYPE_PRRTYACT_CHAT = 12;// 海滩派对聊天
	
	public String accountId;
	public long userId;
	public int platform;
	public long channel;
	//	public String deviceId;
	public String orderId;
	public double money;
	public String logType;
	public String ip;
	public String deviceType = "";//机型
	public String deviceid = "";
	public String device_id_ry = "";// 热云设备ID
	public String who_ry = "";// 热云账号ID（热云账号字段who默认是用userid，有需要改成其他值，就给该字段赋值）
	public String idfa = "";
	public String idfv = "";
	public String imei = "";
	public String oaid = "";//安卓设备匿名标识符，详情参见：http://msa-alliance.cn/col.jsp?id=120
	public String androidid = "";
	public String ryos = "";

	public String eventName = "";
	public int eventParam1;
	public int eventParam2;
	
	public int monitorType;
	public String monitorParam;
	

	public NewbiRequestInfo(String logType, String accountId, String regDeviceId, int userExtPlatform, long userExtChannel, long userId, JsonObject gobj, Object ...params){
		this.accountId = accountId;
		this.userId = userId;
		//		this.platform = platform;
		//		this.channel = channel;
		if(params.length == 2 && logType == TYPE_PAYMENT) {
			this.orderId = (String) params[0];
			this.money = (double) params[1];
		}
		if(params.length == 2 && logType == TYPE_MONITOR) {
			this.monitorType = (int) params[0];
			this.monitorParam = (String) params[1];
		}
		this.logType = logType;

		//		this.ip = ip;
		//		this.deviceType = deviceType;
		//		this.deviceid = deviceid;
		//		this.idfa = idfa;
		//		this.idfv = idfv;
		//		this.imei = imei;
		//		this.androidid = androidid;
		//		this.ryos = ryos;
		if(gobj != null) {
			this.platform = gobj.containsKey("platform") ? gobj.getInteger("platform"):0;
			this.channel = gobj.containsKey("channel") ? gobj.getLong("channel") : 0;
			this.deviceid = gobj.containsKey("deviceid") ? gobj.getString("deviceid"):"";
			if(this.deviceid == null || this.deviceid.isEmpty()){
				this.deviceid = regDeviceId;//如果客户端本次登录没上行deviceid,则取注册时的deviceid
			}
			this.ip = gobj.containsKey("ip") ? gobj.getString("ip"):"";
			this.deviceType = gobj.containsKey("rydevicetype") ? gobj.getString("rydevicetype"):"";
			this.idfa = gobj.containsKey("idfa") ? gobj.getString("idfa"):"";
			this.idfv = gobj.containsKey("idfv") ? gobj.getString("idfv"):"";
			this.imei = gobj.containsKey("imei") ? gobj.getString("imei"):"";
			this.androidid = gobj.containsKey("androidid") ? gobj.getString("androidid"):"";
			this.oaid = gobj.containsKey("oaid") ? gobj.getString("oaid"):"";
			this.ryos = gobj.containsKey("ryos") ? gobj.getString("ryos"):"";
			this.device_id_ry = gobj.containsKey("device_id_ry") ? gobj.getString("device_id_ry"):"";
		}

		// 玩家离线时到账取不到gateObj,则取注册时的Platform,channel,和设备id
		if (this.platform == 0) {
			this.platform = userExtPlatform;
			this.channel = userExtChannel;
		}
		if (this.deviceid == null || this.deviceid.isEmpty()){
			this.deviceid = regDeviceId;//如果客户端本次登录没上行deviceid,则取注册时的deviceid
		}

	}
	public String getAccountId() {
		return accountId;
	}

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public int getPlatform() {
		return platform;
	}

	public void setPlatform(int platform) {
		this.platform = platform;
	}

	public long getChannel() {
		return channel;
	}

	public void setChannel(long channel) {
		this.channel = channel;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public double getMoney() {
		return money;
	}

	public void setMoney(double money) {
		this.money = money;
	}

	public String getLogType() {
		return logType;
	}

	public void setLogType(String logType) {
		this.logType = logType;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(String deviceType) {
		this.deviceType = deviceType;
	}

	public String getDeviceid() {
		return deviceid;
	}

	public void setDeviceid(String deviceid) {
		this.deviceid = deviceid;
	}

	public String getIdfa() {
		return idfa;
	}

	public void setIdfa(String idfa) {
		this.idfa = idfa;
	}

	public String getIdfv() {
		return idfv;
	}

	public void setIdfv(String idfv) {
		this.idfv = idfv;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}
	
	public String getOaid() {
		return oaid;
	}

	public void setOaid(String oaid) {
		this.oaid = oaid;
	}

	public String getAndroidid() {
		return androidid;
	}

	public void setAndroidid(String androidid) {
		this.androidid = androidid;
	}

	public String getRyos() {
		return ryos;
	}

	public void setRyos(String ryos) {
		this.ryos = ryos;
	}

	public String getEventName() {
		return eventName;
	}

	public void setEventName(String eventName) {
		this.eventName = eventName;
	}

	public int getEventParam1() {
		return eventParam1;
	}

	public void setEventParam1(int eventParam1) {
		this.eventParam1 = eventParam1;
	}

	public int getEventParam2() {
		return eventParam2;
	}

	public void setEventParam2(int eventParam2) {
		this.eventParam2 = eventParam2;
	}

	public void setWho_ry(String who_ry) {
		this.who_ry = who_ry;
	}

}
